# Replication Package: Sectoral Savings Decomposition: Where Does Demographic Capital Come From?

**Paper 25 in the Demographics & Global Capital Allocation series**
**Brian Peters, March 2026**

---

## Overview

This paper decomposes the demographic savings channel by sector. Key findings: the demographic savings effect operates ~66% through private saving and ~25% through government saving. All survive two-way country+year FE — the strongest within-country identification in the series. OECD shows fiscal reversal: aging worsens government saving (Z₁ = -43.1*).

## Software Requirements

- Python 3.10+
- Required packages: `numpy`, `pandas`, `statsmodels`, `scipy`, `matplotlib`, `python-docx`
- Install: `pip install numpy pandas statsmodels scipy matplotlib python-docx`

## Directory Structure

```
replication/
  REPLICATION_README.md
  scripts/
    phase1_data_assembly.py      # Data assembly (merges sectoral savings, demographics)
    phase2_baseline.py           # Baseline savings decomposition regressions
    phase3_mechanisms.py         # OECD/non-OECD splits, income interactions, mediation
    phase4_referee_fixes.py      # Referee-requested robustness
    build_docx.py                # DOCX generation
  src/
    model.py                     # PanelGLS estimator (shared across series)
    [other shared modules]
  data/
    processed/
      sectoral_panel.csv         # Processed panel (private/govt savings, demographics)
    raw/
      wdi_savings.csv            # WDI savings components
  output/tables/
    [26 markdown tables]         # All regression output
  paper/
    paper.md                     # Manuscript source
```

## Reproduction

Run scripts in order:
```bash
python3 scripts/phase1_data_assembly.py
python3 scripts/phase2_baseline.py
python3 scripts/phase3_mechanisms.py
python3 scripts/phase4_referee_fixes.py
```

**Note:** Scripts use absolute paths (`/mnt/c/demographics_capital_flows/...`). Update the path references at the top of each script for your local environment.

## Data Sources

- UN World Population Prospects (2024 Revision) — age distributions
- World Bank WDI — gross domestic savings, government final consumption
- IMF WEO — fiscal balance, GDP, current account
- Penn World Table 10.01 — output per worker
- Chinn-Ito KAOPEN — capital account openness
- Lane-Milesi-Ferretti — net foreign assets
